import {getTrade,submitOrder,getPayInfo,getPayState,getOrders} from "http/http"

const OK = 200
export default {
    state:{
        trade:{},
        orderInfo:{}, //订单信息
        payInfo:{}, //支付信息
    },
    getters:{},
    mutations:{
        getTrade(state,trade){
            state.trade = trade
        },
    },
    actions:{
        //获取订单详情
        async getTrade(store){
            const {code,data} = await getTrade()
            store.commit("getTrade",data)
        },
        //我的订单
        async getClientInformation({commit}, {page, limit}){
            const {code,data} = await getOrders(page,limit)
            console.log(code,data)
            if(code===OK){
                commit("getOrders",data)
            }
            return {code,data}
        }
    },
}